package com.imooc.dynamic.raw;

import java.lang.reflect.Proxy;

/**
 * @Author Tim
 * @Description:
 * @Version 1.0
 */
public class Test {

    public static void main(String[] args) {
//        UserServiceImpl userServiceImp = new UserServiceImpl();
//
//        UserService userService = (UserService) Proxy.newProxyInstance(userServiceImp.getClass().getClassLoader(),
//                userServiceImp.getClass().getInterfaces(), new ProxyHandler(userServiceImp));
//        userService.addUser("imooc.com");

        OrderServiceImpl orderServiceImpl = new OrderServiceImpl();
        OrderService orderService = (OrderService) Proxy.newProxyInstance(orderServiceImpl.getClass().getClassLoader(),
                orderServiceImpl.getClass().getInterfaces(), new ProxyHandler(orderServiceImpl));
        orderService.addOrder("java数据中台项目实战开发课程");
    }
}
